console.log('html-edit-switch注入成功');
const DESIGN_MODE_STATUS = 'designModeStatus';

(function init() {
  document.designMode = sessionStorage.getItem(DESIGN_MODE_STATUS) ?? 'off';
}());

//监听消息
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
    let callMap = {
      getDesignMode: () => {
        sendResponse(document.designMode);
      },
      changeDesignMode: () => {
        document.designMode = document.designMode === 'off' ? 'on' : 'off';
        sessionStorage.setItem(DESIGN_MODE_STATUS, document.designMode);
        sendResponse(document.designMode);
      }
    }[message.type]();
    console.log(message.type);
  }
);